import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class HelloServlet extends HttpServlet {

    /**
     *
     * @param request
     * @param response
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

        //设置响应到客户端的文本类型为:HTML,编码格式为:UTF-8
        response.setContentType("text/html;charset=utf-8");
        //获取输出流
        PrintWriter out = response.getWriter();
        out.println("Hello world");

    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) {

    }
}
